#ifndef SCHED_H
#define SCHED_H

///
// Portions of this code contributed by Napalm (napalm@netcore2k.net)
//

/// XXXX FIX ME
typedef unsigned int dword;
typedef unsigned short word;
typedef int bool;
typedef void (*startaddress)(void *);

// xxx obsolete
typedef struct TAGthread_list_t {
  struct TAGthread_list_t *next, *prev;
  unsigned int *stack, esp;		// scheduling shit
  startaddress start;			// start address
  unsigned long prio, quantum;		// priority and time left
  unsigned long expiry;			// expiry
  unsigned long tid;
} thread_list_t;

#define SCHED_QUANTUM 40

extern thread_list_t *currentthread, *readyqueue, *waitqueue;

extern void sched_install();
extern unsigned int sched_contextswitch(unsigned int oldesp);

extern void sched_endthread();
extern void sched_killthread(thread_list_t *);

extern int sched_createthread(startaddress start, void * argument);


#endif
